/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.riversoft.weixin.gateway.service;

import java.util.Date;

/**
 *
 * @author johns
 */
public interface RedisService {

    /**
     *
     * 判断key是否存在
     *
     * @param key
     */
    boolean existsKey(final String key);

    /**
     * 获取指定时长后的Date
     * @param expireTime
     * @return
     */
    Date getDateAferExpire(int expireTime);

    /**
     * 根据key 获取对应的value
     *
     * @param key
     */
    Object getValueByKey(final String key);

    /**
     *  redis 锁
     * @param lock 锁的key
     * @param expire 锁的时长
     * @return
     */
    Boolean redisLock(final String lock, final int expire);

    /**
     * 删除指定的key
     *
     * @param key
     */
    void removeByKey(final String key);

    /**
     * 设置带有指定时长的key value
     * @param key
     * @param value
     * @param expireTime
     * @return
     */
    boolean setKeyValueWithExpire(final String key, Object value, Long expireTime);
    
}
